package com.lwl.blue.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lwl.blue.commont.base.JsonResult;
import com.lwl.blue.commont.base.PageParam;
import com.lwl.blue.dao.DepartmentDao;
import com.lwl.blue.entity.Department;
import com.lwl.blue.service.DepartmentService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class DepartmentServiceImpl extends ServiceImpl<DepartmentDao, Department> implements DepartmentService {

    @Resource
    DepartmentDao dao;

    /**
     * 分页查询部门列表
     * @param pageParam
     * @return
     */
    @Override
    public JsonResult<Page<Department>> pages(PageParam<Department> pageParam) {
        Page<Department> page = new Page<>(pageParam.getPageNum(), pageParam.getPageSize());
        return new JsonResult<Page<Department>>().success(dao.pages(page, pageParam.getParam()));

    }
}
